package com.uuah.server.config.spring;

import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
import org.springframework.beans.factory.xml.XmlReaderContext;
import org.springframework.util.StringUtils;
import org.w3c.dom.Element;

/**
 *
 * TODO comment ...
 *
 * <p>
 * update record:updator，update time，update content and version
 * </p>
 *
 * @author <a href="jonny_quan@hotmail.com">jonny</a>
 * @date 2009 2009-3-27 下午01:24:34
 * @version 1.0.0
 */
public class UuahBeanDefinitionDocumentReader extends
		DefaultBeanDefinitionDocumentReader {

	protected BeanDefinitionParserDelegate createHelper(
			XmlReaderContext readerContext, Element root) {
		BeanDefinitionParserDelegate delegate = new UuahHierarchicalBeanDefinitionParserDelegate(
				readerContext, this);
		delegate.initDefaults(root);
		return delegate;
	}

	protected void parseBeanDefinitions(Element root,
			BeanDefinitionParserDelegate delegate) {
		if (!StringUtils.hasLength(root.getNamespaceURI())) {
			getReaderContext().error(
					"Unable to locate NamespaceHandler for namespace [null]",
					root);
		} else {
			super.parseBeanDefinitions(root, delegate);
		}
	}

}
